package com.t2t.top.monitor;

/**
 * Created by yangpengfei on 2016/9/20.
 * <p/>
 * 获取服务器线程信息
 */
public class MonitoringTest {
    public static void main(String[] args) {
        for (Thread thread : Thread.getAllStackTraces().keySet()) {
            StackTraceElement[] st = thread.getStackTrace();
            System.out.println("线程," + thread.getName() + "," + thread.getId());
            for (StackTraceElement stackTraceElement : st) {
                System.out.println("线程(栈信息)," + thread.getName() + "," + thread.getId() + "," + stackTraceElement.getClassName());
            }
        }
    }
}
